import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liuxlcommon/lget/LGetScaffold.dart';
import 'package:liuxlcommon/lget/LState.dart';
import 'package:liuxlcommon/util/string_utils.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:liuxlcommon/view/my_box.dart';
import 'package:love_newf/app/com/base/app.dart';
import 'package:love_newf/app/com/base/router_manage.dart';
import 'package:love_newf/app/com/view/my_app_bar.dart';
import 'package:love_newf/app/com/base/key_mix.dart';
import 'package:love_newf/generated/assets.dart';
import 'package:love_newf/value/app_const.dart';

import 'user_info_logic.dart';

class UserInfoPageState extends LState  {
  final logic = Get.put(UserInfoLogic());

  @override
  get init => logic.getData();

  @override
  get body => LGetScaffold<UserInfoLogic>(
      appBar: MyAppBar(
          App.localeEn ? "Identity information" : "Informasi identitas"),
      builder: () => LFlexV([
            10.lsh,
            // LImage.easy(Assets.icUserHead,71.w,71.w),
            LText.easy("usernane", 20.sp, fw5).margin(top: 15.w, bottom: 10.w),
            itemView(
                App.localeEn ? "ID number" : "nomor ID", logic.data['name'.hx]),
            itemView(App.localeEn ? "Name" : "Nama", logic.data['idNumber'.hx]),
            itemView(App.localeEn ? "Birthday" : "Hari ulang tahun",
                logic.data['neighbor'.hx]),
            [
              LImage.easy(logic.data['yawned'.hx], 90.w, 138.w),
              LExpand(),
              LImage.easy(logic.data['fastened'.hx], 90.w, 138.w),
            ].row.css(
                'width: 339px;height: 138px;background: #F5F5F5;padding:24px 17px;border-radius: 8px;')
          ]).size(375.w, null));

  itemView(title, value) {
    return LFlexH([
      LText.easy(title ?? "", 14.sp, fw6).flex(1),
      LText.easy(value ?? "", 14.sp),
    ])
        .css(
            'width: 339px;height: 60px;background: #F5F5F5;border-radius: 8px;padding:0 15px')
        .margin(bottom: 20.w);
  }

  @override
  get finish {
    Get.delete<UserInfoLogic>();
  }
}
